package com.sky.controller.notify;

import com.alibaba.fastjson.JSON;
import com.sky.websocket.WebSocketServer;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@Api(tags = "模拟支付成功微信发送请求")
@Slf4j
@RestController
public class PayNotifyController {
    @Autowired
    WebSocketServer webSocketServer;
    //@GetMapping("/sendOrderMsg")
    public void sendOrderMsg(Long orderId,String outTradeNo){
        HashMap<String, Object> map = new HashMap<>();
        map.put("type",1);
        map.put("orderId",orderId);
        map.put("content","订单号:"+outTradeNo);
        webSocketServer.sendToAllClient(JSON.toJSONString(map));
    }
}
